package cn.nawang.ebeim.client.bean;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class UploadQueue {

  private static BlockingQueue<BackupTask> uploadQueue =
      new ArrayBlockingQueue<BackupTask>(ClientConfiguration.getQueueSize());

  public static BlockingQueue<BackupTask> getUploadQueue() {
    return uploadQueue;
  }

  public static void enqueue(BackupTask task) throws InterruptedException {
    uploadQueue.put(task);
  }

  public static BackupTask dequeue() throws InterruptedException {
    return uploadQueue.take();
  }

  public static boolean isEmpty() {
    return uploadQueue.isEmpty();
  }
}
